<%@page language="java" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>用户登录</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<style type="text/css">
body {
	background-image: url(themes/img/login/backgroup.jpg);
	margin-top: 167px;
}
.title {
	font-family: "方正大标宋简体";
	font-size: 22px;
	vertical-align: middle;
	padding-top: 20px;
}
.logo {
	padding-top: 8px;
	padding-left: 20px;
}
.txt {
	color: #094786;
	font-family: "宋体";
	font-size: 12px;
}
</style>
<script type="text/javascript" src="js/jquery/jquery.js"></script>
<script type="text/javascript" src="js/util/util.js"></script>
<script type="text/javascript">
$(function() {

	//单击登录按钮，提交表单。
	$("#login").click(function() {
		var validcode = $("#validcode").val();
		var randcode = $("#randcode").val();
		if(validcode==randcode)
		{
			$("#form").submit();
		}
		else
		{
			alert("验证码错误！");
		}
	});

	//单击重置按钮，清空文本。
	$("#reset").click(function() {
		//清空账号，密码，并让账号获得焦点。
			$("#account").val("");
			$("#password").val("");
			$("#account").focus();
		});

	//登录后弹出提示框，如果登录出错。
	if ("${errorMsg}" != "") {
		alert("${errorMsg}");
	}

	//给表单注册回车即可提交。
	registKeydown("account");
	registKeydown("password");

	//账号获得焦点并且选中文本。
	$("#account").focus();
	$("#account").select();
});

//回车即可提交表单的注册。
function registKeydown(id) {
	$("#" + id).keydown(function(event) {
		if (event.keyCode == 13) {
			$("#form").submit();
		}
	});
}

$(function()
{
	$("#img_yzm").click(function()
	{
		var _this=this;
		var src=ctx+"/servlet/ValidCode";
		$.post(ctx+"/getRand.htm",function(data)
		{
			_this.src=src+"?rand="+data;
			$("#randcode").val(data);
		});
	});
	$("#img_yzm").trigger("click");
});

</script>
</head>
<body>
<form id="form" action="login2.htm" method="post" class="cmxform">
<table width="592" border="0" align="center" cellpadding="0"
	cellspacing="0">
	<tr>
		<td height="69" background="themes/img/login/back01.gif">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td class="logo">
					</td>
					<td class="title">
						广州五羊油漆股份有限公司进销存管理系统
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td height="152" background="themes/img/login/back02.gif">
			<table width="100%" border="0" cellspacing="0" cellpadding="3"
				class="txt">
				<tr>
					<td width="289" />
					<td>账号</td>
					<td>
						<input id="account" name="account" type="text" size="20" value="admin" />
					</td>
				</tr>
				<tr>
					<td width="289" />
					<td>密码</td>
					<td>
						<input id="password" name="password" type="password" size="22" value="admin"/>
					</td>
				</tr>
				<tr>
					<td width="289" />
					<td >验证码</td>
					<td>
						<input id="validcode" name="validcode" type="text" size="9" value=""/>
						<img id="img_yzm" />
					</td>
				</tr>
				<tr>
					<td width="289" />
					<td><a href="${pageContext.request.contextPath}/manage/sys/user/reg.htm">用户申请</a>                    </td>
					<td>
						<a href="#"><img id="login" src="themes/img/login/login.jpg" width="56" height="20" hspace="9" vspace="5" style="border: 0px;" /></a>
						<a href="#"><img id="reset" src="themes/img/login/replay.jpg" width="56" height="20" vspace="5" style="border: 0px;"/></a>
					</td>
				</tr>
				
			</table>
		</td>
	</tr>
	<tr>
		<td height="32" align="center" background="themes/img/login/back03.gif" class="txt">
			<img src="themes/img/login/icon.gif" width="10" height="10" />
			广州五羊油漆股份有限公司 Copyright
			<span style="font-size: 16px;">&copy;</span> 2012 版权所有
		</td>
	</tr>
	<tr>
		<td height="90" background="themes/img/login/back04.png" />
	</tr>
</table>
<input type="hidden" id="randcode" value=""/>
</form>
</body>
</html>
